import { defineStore } from "pinia";

export const useTokenStore = defineStore("token", {
  state: () => ({
    sources: [],
  }),
  actions: {
    addSource(source) {
      this.sources.push(source);
    },
    cancelAll() {
      this.sources.forEach((source) => {
        source.cancel("取消请求");
      });
      this.sources = [];
    },
  },
});
